From 1d45c8ef8c7f34aa117b5377368608fa02f73c87 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 1 May 2008 16:08:36 +0100 Subject: [PATCH] x86 hvm cpuid: fix some problem with the hvm's cpuid configuration. - When we overwrite a cpuid's input, apply the default policy for the other registers. - For the python binding, get unsigned long instead long. - Fix the multiple inputs cpuid's configuration parsing. Signed-off-by: Jean Guyader --- tools/libxc/xc_cpuid_x86.c | 3 +++ tools/python/xen/lowlevel/xc/xc.c | 2 +- tools/python/xen/xm/create.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index f59618236e..2317b4d38d 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -385,7 +385,10 @@ int xc_cpuid_set( for ( i = 0; i < 4; i++ ) { if ( config[i] == NULL ) + { + regs[i] = polregs[i]; continue; + } config_transformed[i] = alloc_str(); diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 709bbba62b..136634a59b 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -696,7 +696,7 @@ static PyObject *pyxc_dom_set_cpuid(XcObject *self, unsigned int input[2]; char *regs[4], *regs_transform[4]; - if ( !PyArg_ParseTuple(args, "iiOO", &domid, + if ( !PyArg_ParseTuple(args, "IIOO", &domid, &input[0], &sub_input, &config) ) return NULL; diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 7dc83f59b3..6c1b5c049c 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -856,7 +856,9 @@ def preprocess_cpuid(vals, attr_name): if not vals.cpuid: return cpuid = {} for cpuid_input in getattr(vals, attr_name): - cpuid_match = re.match(r"(?P(0x)?[0-9A-Fa-f]+):(?P.*)", cpuid_input) + input_re = "(0x)?[0-9A-Fa-f]+(,(0x)?[0-9A-Fa-f]+)?" + cpuid_match = re.match(r'(?P%s):(?P.*)' % \ + input_re, cpuid_input) if cpuid_match != None: res_cpuid = cpuid_match.groupdict() input = res_cpuid['input'] -- 2.30.2